<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
</head>
<body>
	<div class="ibox-content">
		<form class="form-horizontal" id="dataform"
			onsubmit="javascripr:return false;">
			<input type="hidden" name="tokenUrl" value="${tokenUrl}"> <input
				type="hidden" name="token" value="${token}">
			<c:if test="${obj ne null }">
				<input type="hidden" name="desId" value="${obj.desId }">
			</c:if>
			<div class="form-group">
				<label class="col-sm-2 control-label">帐号 <span class="text-danger">*</span></label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="desAccount"
						maxLength="20" dataType="m" 
						<c:if test="${obj.desAccount ne null}"> readonly="readonly" </c:if>
						value="<c:out value="${obj.desAccount }"></c:out>"
						nullmsg="帐号不能为空">
				</div>
				<c:if test="${obj ne null}">
				<label class="col-sm-2 control-label">名称 <span class="text-danger">*</span></label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="desName"
						maxLength="50" dataType="*1-50" 
						value="<c:out value="${obj.desName }"></c:out>" nullmsg="名称不能为空">
				</div>
				</c:if>
				<c:if test="${obj eq null}">
					<label class="col-sm-2 control-label">密码 <span class="text-danger">*</span></label>
					<div class="col-sm-4">
						<input type="text" class="form-control" name="desPassword"
							maxLength="20" dataType="/^[0-9a-zA-Z]{6,20}$/"
							value="123456" nullmsg="密码不能为空" errormsg="密码需6-20位字母与数字组合">
					</div>
				</c:if>
			</div>
			<c:if test="${obj ne null}">
			<div class="form-group">
				<label class="col-sm-2 control-label">性别 <span class="text-danger">*</span></label>
				<div class="col-sm-4">
					<select class="form-control select2" name="desSex" dataType="s1-2"
						nullmsg="性别不能为空">
						<option value="0">未知</option>
						<option
							<c:if test="${obj.desSex eq 1}"> selected="selected"</c:if>
							value="1">男</option>
						<option
							<c:if test="${obj.desSex eq 2}"> selected="selected"</c:if>
							value="2">女</option>
					</select>
				</div>
				<label class="col-sm-2 control-label">头像 </label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="desHeadimgurl"
						maxLength="200" dataType="*1-200" ignore="ignore"
						value="<c:out value="${obj.desHeadimgurl }"></c:out>"
						nullmsg="头像不能为空">
				</div>
			</div>
			</c:if>
			<div class="form-group">
				<label class="col-sm-2 control-label">上级设计师 </label>
				<div class="col-sm-4">
<!-- 					<input type="text" class="form-control" name="desParentId" -->
<!-- 						maxLength="20" dataType="s1-20" ignore="ignore" -->
<%-- 						value="<c:out value="${obj.desParentId }"></c:out>" --%>
<!-- 						nullmsg="上级设计师不能为空"> -->
					<select class="form-control autoFull select2" dataType="*" nullmsg="上级设计师不能为空" 
						data-url="${path}/admin/disDesigner/showAll" ignore="ignore" 
						data-value="desId" data-filed="desName" data-hidden="${obj.desId}"
						data-def="${obj.desParentId}" name="desParentId">
						<option value=''>--请选择上级设计师--</option>
					</select>
				</div>
				<label class="col-sm-2 control-label">审核状态 <span class="text-danger">*</span></label>
				<div class="col-sm-4">
					<select class="form-control select2" name="desAuditStatus"
						dataType="s1-2" ignore="ignore" nullmsg="审核状态不能为空">
						<option
							<c:if test="${obj.desAuditStatus eq 1}"> selected="selected"</c:if>
							value="1">待审核</option>
						<option
							<c:if test="${obj eq null or obj.desAuditStatus eq 2}"> selected="selected"</c:if>
							value="2">审核通过</option>
						<option
							<c:if test="${obj.desAuditStatus eq 3}"> selected="selected"</c:if>
							value="3">审核不通过</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">客户返点比例(%) <span class="text-danger">*</span></label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="desRebateProportion"
						maxLength="5" dataType="/^[0-9]{1,2}(\.[0-9]{1,2})?$/"
						value="<c:out value="${obj.desRebateProportion }"></c:out>"
						nullmsg="返点比例不能为空" errormsg="格式错误，示例：xx.xx">
				</div>
				<label class="col-sm-2 control-label">下级返点比例(%) <span class="text-danger">*</span></label>
				<div class="col-sm-4">
					<input type="text" class="form-control" name="desSubProportion"
						maxLength="5" dataType="/^[0-9]{1,2}(\.[0-9]{1,2})?$/"
						value="<c:out value="${obj.desSubProportion }"></c:out>"
						nullmsg="返点比例不能为空" errormsg="格式错误，示例：xx.xx">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">备注 </label>
				<div class="col-sm-10">
					<input type="text" class="form-control" name="desRemark"
						maxLength="100" dataType="*1-100" ignore="ignore" 
						value="<c:out value="${obj.desRemark }"></c:out>" nullmsg="备注不能为空">
				</div>
			</div>
			<div class="form-group ">
				<div class="col-sm-12 text-center">
					<a href="javascript:;" onclick="myForm.submit()"
						class="btn btn-success radius"><i class="fa fa-check"></i> 保存</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a class="btn btn-danger radius" href="javascript:;"
						onclick="MTools.closeForm()"><i class="fa fa-close"></i> 关闭</a>
				</div>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript"
	src="${path }/resource/js/systools/MJsBase.js"></script>
<script type="text/javascript">
	MTools.autoFullSelect();
	$(".select2").select2();
	var myForm = MForm.initForm({
		invokeUrl : "${path}/admin/disDesigner/addOrModify",
		afterSubmit : function() {
			parent.myGrid.serchData();
		},
	});
</script>
</body>
</html>